import api from './api.js';
import http from './http.js';

/**
 * 系统公共方法
 * 
 */
var common = {}

/**
 * 更新购物车底部budget
 */
common.updateCartNums = function(  ){

    api.getCartProductSums ( {} , function( response ){

        if(response.status==1){

            if(response.data>0){
                wx.setTabBarBadge({
                    index: 2,
                    text: ""+response.data
                  })

            }else{
                wx.removeTabBarBadge({
                    index: 2,
                })
            }

        }else{

            wx.removeTabBarBadge({
                index: 2,
              })

        }
    })

}

module.exports = common;


